package utils;

import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.PreparedStatement;
import java.sql.ResultSet;

public class DBConn {

	public Connection conn;
	public PreparedStatement ps;
	public ResultSet rs;
	public String jdbc="oracle.jdbc.driver.OracleDriver";
	public String url="jdbc:oracle:thin:@localhost:1521:XE";
	
	public void getConnection(){
		try{
			Class.forName(jdbc);
			conn=DriverManager.getConnection(url,"s4197417","melati0831");
		}catch(Exception e){
			e.printStackTrace();
		}
	}
	
	public void closeConnection(){
		try{
			if(rs!=null){
				rs.close();
			}
			if(ps!=null){
				ps.close();
			}
			if(conn!=null){
				conn.close();
			}
		}catch(Exception e){
			e.printStackTrace();
		}
	}
}
